package com.jjty.dataGenerator.jshjy.controller;

import com.jjty.dataGenerator.jshjy.service.AttendancePushService;
import com.jjty.dataGenerator.jshjy.service.CallPushService;
import com.jjty.dataGenerator.jshjy.service.HeartbeatPushService;
import com.jjty.dataGenerator.jshjy.service.LocationPushService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/data/push/batch")
public class BatchPushController {

    @Autowired
    private HeartbeatPushService heartbeatPushService;
    @Autowired
    private LocationPushService locationPushService;
    @Autowired
    private CallPushService callPushService;
    @Autowired
    private AttendancePushService attendancePushService;

    /**
     * 批量推送心跳数据
     * @param limit 推送数量（默认10条）
     * @return 推送结果
     */
    @PostMapping("/heartbeat")
    public String batchPushHeartbeat(@RequestParam(defaultValue = "10") int limit) {
        return heartbeatPushService.pushBatchHeartbeat(limit);
    }

    /**
     * 批量推送定位数据
     * @param limit 推送数量（默认10条）
     * @return 推送结果
     */
    @PostMapping("/location")
    public String batchPushLocation(@RequestParam(defaultValue = "10") int limit) {
        return locationPushService.pushBatchLocation(limit);
    }

    /**
     * 批量推送通话数据
     * @param limit 推送数量（默认10条）
     * @return 推送结果
     */
    @PostMapping("/call")
    public String batchPushCall(@RequestParam(defaultValue = "10") int limit) {
        return callPushService.pushBatchCall(limit);
    }

    /**
     * 批量推送考勤数据
     * @param limit 推送数量（默认10条）
     * @return 推送结果
     */
    @PostMapping("/attendance")
    public String batchPushAttendance(@RequestParam(defaultValue = "10") int limit) {
        return attendancePushService.pushBatchAttendance(limit);
    }
}